<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="index.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="favicon.ico">
<link rel="Shortcut Icon" href="favicon.ico" />

<title>主页</title>
<meta name="keywords" content="耶回收">
<meta name="description" content="耶回收">

</head>
<body>
	<!--_表格--开始-->
	<section class="Hui-article-box" style="overflow: auto"> <nav
		class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
	新闻管理 <span class="c-gray en">&gt;</span> 新闻信息管理 <a
		class="btn btn-success radius r"
		style="line-height: 1.6em; margin-top: 3px"
		href="javascript:location.replace('newssel?pageNum=1&createdq=&createdh=&title=')"
		title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a> </nav>


	<div class="Hui-article">
		<article class="cl pd-20">
		<div class="text-c">
			<form action="newssel" method="post">
				时间：<input type="date" class="input-text" style="width: 150px"
					placeholder="" value="${np.createdq }" id="" name="createdq">-
				<input type="date" class="input-text" style="width: 150px"
					placeholder="" value="${np.createdh }" id="" name="createdh">
				新闻主题：<input type="text" class="input-text" style="width: 250px"
					placeholder="输入商品名" onblur="titleyz(this.id)" value="${np.title }" id="title" name="title">
				<i class="Hui-iconfont">&#xe665;</i><input type="submit"
					class="btn btn-success" value="搜新闻" id="" name="">
			</form>
		</div>

		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l"><a href="newsaddtz"
				class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>
					添加新闻</a> </span> <span class="r">共有数据：<strong>${pageinfo.total }</strong>
				条
			</span>
		</div>
		<table class="table table-border table-bordered table-bg">
			<thead>
				<tr>
					<th scope="col" colspan="7">新闻列表</th>
				</tr>
				<tr class="text-c">
					<th width="100">新闻主题</th>
					<th width="100">新闻主题描述</th>
					<th width="100">图片</th>
					<th width="100">新闻链接</th>
					<th width="100">录入时间</th>
					<th width="100">新闻状态</th>
					<th width="100">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${pageinfo.list }" var="list">
					<tr class="text-c">
						<td>${list.title }</td>
						<td>${list.descrip }</td>
						<td><img height="50px" width="50px" src="${list.image }"></td>
						<td>${list.link }</td>
						<td><fmt:formatDate value="${list.created}"
								pattern="yyyy-MM-dd" /></td>
						<c:if test="${list.status==1 }">
							<td>主新闻</td>
						</c:if>
						<c:if test="${list.status==2 }">
							<td>次新闻</td>
						</c:if>
						<td class="td-manage"><a title="编辑"
							href="newsupdatetz?nid=${list.nid }" class="ml-5"
							style="text-decoration: none"><i class="Hui-iconfont">&#xe6df;</i></a>
							<a title="删除" href="javascript:;"
							onclick="news_del(${list.nid })" class="ml-5"
							style="text-decoration: none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
					</tr>
				</c:forEach>
			</tbody>
			<thead>
				<tr>
					<th colspan="7"><p>第${pageinfo.pageNum}页
							共${pageinfo.pages}页</p> <a
						href="newssel?pageNum=1&createdq=${np.createdq }&createdh=${np.createdh }&title=${np.title }">首页</a>
						<c:choose>
							<c:when test="${pageinfo.pageNum==1||pageinfo.pageNum==0 }">
								<a href="#">上一页</a>
							</c:when>
							<c:otherwise>
								<a
									href="newssel?pageNum=${pageinfo.prePage}&createdq=${np.createdq }&createdh=${np.createdh }&title=${np.title }">上一页</a>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${pageinfo.pageNum==pageinfo.pages }">
								<a href="#">下一页</a>
							</c:when>
							<c:otherwise>
								<a
									href="newssel?pageNum=${pageinfo.nextPage}&createdq=${np.createdq }&createdh=${np.createdh }&title=${np.title }">下一页</a>
							</c:otherwise>
						</c:choose> <a
						href="newssel?pageNum=${pageinfo.pages}&createdq=${np.createdq }&createdh=${np.createdh }&title=${np.title }">尾页</a>
					</th>
				</tr>
			</thead>
		</table>
		</article>
	</div>
	</section>
</body>

<script type="text/javascript">
	/*商品-删除*/
    function news_del(id){
        layer.confirm('确认要删除吗？',{ btn: ["确定","取消"] },function(index){
            $.ajax({
                type: 'POST',
                url: 'newsdele',
                data:{nid:id},
                dataType: 'json',
                success: function(val){
                	layer.close(index);
                	if(val==1){
                		alert("删除成功!");
                	};
                	if(val==2){
                		alert("删除失败！");
                	};
                	
                	window.location.href = window.location.href;                	
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
	
	
    /*商品名验证*/
    function titleyz(id){
    	var v=$("#"+id).val();
    	if(v.indexOf('"')==0){
    		$("#"+id).val(null)
    		alert('输入不能包含"！');
    	}
    }
</script>
</html>